- if inject_u2f_api?
  - content_for :page_specific_javascripts do
    = page_specific_javascript_tag('u2f.js')

%div
  .login-box
    .login-heading
      %h3 两步验证
    .login-body
      - if @user.two_factor_otp_enabled?
        %h5 通过 Two-Factor 应用进行验证
        = form_for(resource, as: resource_name, url: session_path(resource_name), method: :post) do |f|
          - resource_params = params[resource_name].presence || params
          = f.hidden_field :remember_me, value: resource_params.fetch(:remember_me, 0)
          = f.text_field :otp_attempt, class: 'form-control', placeholder: '两步验证代码', required: true, autofocus: true, autocomplete: 'off'
          %p.help-block.hint 输入手机上的 Two-Factor 应用验证码. 如果丢失了手机，可以输入恢复代码进行验证。
          .prepend-top-20
            = f.submit "验证码", class: "btn btn-save"

      - if @user.two_factor_u2f_enabled?

        %hr
        = render "u2f/authenticate"
